<?php
namespace Manage\Controller;
use Think\Controller;

class CommonController extends Controller {

    protected $sso_uid;
    protected $sso_user;

    protected function _initialize(){
        $sso_user = session('sso_user');
        $this->sso_user = $sso_user ? $sso_user : $this->get_sso_userinfo();
        $this->sso_uid  = $this->sso_user['user_id'];
    }

    private function get_sso_userinfo(){
        $db = zyt_data_init();
        $map['platform_code'] = 'PF_0000004';
        $userinfo = $db->table('platform_info as A')->field('A.user_id, B.user_name')->join('user as B', 'A.user_id = B.user_id')->where($map)->find();
        session('sso_user', $userinfo);
    }
}
